package com.siwei.mes.job;

import com.siwei.mes.common.util.DateHelper;
import com.siwei.mes.mapper.experiment.ExperimentYearConfigMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 清空试验委托当年配置记录
 *
 * @Description: 清空试验委托当年配置记录
 * @Version: 1.0
 * @author: mlchen
 * @date: 2024/8/10 15:45
 */
@Component
public class CleanConcreteYearConfigJob {
    private static final Logger log = LoggerFactory.getLogger("job");
    @Resource
    private ExperimentYearConfigMapper experimentYearConfigMapper;

    @Scheduled(cron = "0 0 0 1 1 ?")
    public void clearInfo() {
        Integer year = DateHelper.getYear();
        experimentYearConfigMapper.clearYearConfigInfo(year);
        log.info("清空【{}】年之前的试验委托当年配置完成！", year);
    }
}
